package com.cw.service.impl;

import com.cw.dto.SystemLogCondition;
import com.cw.dto.operationLogDTO;
import com.cw.entity.ListeningLog;
import com.cw.entity.SysUser;
import com.cw.mapper.SysUserMapper;
import com.cw.mapper2.ListeningLogMapper;
import com.cw.service.IListeningLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 预约日志操作监听表 服务实现类
 * </p>
 *
 * @author xnd
 * @since 2023-11-20
 */
@Service
public class ListeningLogServiceImpl extends ServiceImpl<ListeningLogMapper, ListeningLog> implements IListeningLogService {

    @Autowired
    private ListeningLogMapper listeningLogMapper;

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public List<ListeningLog> operationLogPageList(operationLogDTO dto) {
        List<ListeningLog> listeningLogs = listeningLogMapper.operationLogPageList(dto);
        if (listeningLogs.isEmpty()){
            return new ArrayList<>();
        }
        return listeningLogs;
    }

    @Override
    public List<SysUser> userList(SystemLogCondition condition) {
        return sysUserMapper.getSysUsers(condition);
    }
}
